import { Controller, Get } from '@nestjs/common';
import { ObjectUtils } from '../utils/object-utils';
import { BooksService } from '../books/books.service';
import { BookVo } from '../books/vo/book.vo';

@Controller('test')
export class TestController {
  constructor(private readonly booksService:BooksService) {
  }
  @Get()
  getHello(): String {
    const obj = {a:{c:1}};
    const obj2 = {a:{d:2}};
    // console.log(Object.assign(obj,obj2));
    let b = ObjectUtils.deepMerge(obj, obj2)
    if(!ObjectUtils.isEmptyObject(obj)){
      const  c =ObjectUtils.copyObject(obj);
      console.log('c=',c);
    }
    console.log('b=',b);
    return 'success';
  }
  @Get("/findBooksAll")
  getBookGraphqlData(): Promise<BookVo[]> {
    return this.booksService.findAll();
  }
}